package com.yl.home.viewmodel

import com.yl.common.base.BaseViewModel
import com.yl.common.network.RespStateData
import com.yl.home.bean.Article
import com.yl.home.bean.Banner
import com.yl.home.repo.HomeRepo

/**
 * Created by stew on 8/5/22.
 */
class HomeViewModel(private var repo: HomeRepo) : BaseViewModel() {

    var bannerList = RespStateData<List<Banner>>()
    fun getBanner() = launch { repo.getBanner(bannerList) }

    var article = RespStateData<Article>()
    fun getArticle(page:Int) = launch { repo.getArticle(page,article) }

    var collectData = RespStateData<String>()
    fun unCollect(id:Int) = launch { repo.unCollect(id,collectData) }
    fun collect(id:Int) = launch { repo.collect(id,collectData) }
}